/**
 *       Copyright (c) 2012 Lukas Zaruba
 *
 *   This file is part of Robot Playground.
 *
 *   Robot Playground is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Robot Playground is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Robot Playground. If not, see <http://www.gnu.org/licenses/>.
 */
package net.zarubsys.robotplayground.dummydevice.modules;

import net.zarubsys.robotplayground.core.Environment;
import net.zarubsys.robotplayground.core.modules.AbstractModule;
import net.zarubsys.robotplayground.core.modules.EmptyModuleConfiguration;
import net.zarubsys.robotplayground.core.modules.annotations.Function;
import net.zarubsys.robotplayground.dummydevice.DummyDevice;

/**
 * DummyTelemetryModule
 *
 * @author Lukas Zaruba, lukas.zaruba@gmail.com
 */
public class DummyTelemetryModule extends AbstractModule<DummyDevice, EmptyModuleConfiguration> {
	
	public static final String ID = "dummyTelemetry";
	
	private DummyDevice device;

	@Override
	public void init(DummyDevice device, EmptyModuleConfiguration configuration, Environment env) {
		this.device = device;
	}

	@Override
	public void close() {
		// ignored, nothing to be closed
	}

	@Override
	public String getId() {
		return ID;
	}
	
	@Function(description = "Returns X position of the dummy device")
	public Integer getX() {
		return device.getX();
	}
	
	@Function(description = "Returns Y position of the dummy device")
	public Integer getY() {
		return device.getY();
	}
	
	@Function(description = "Returns direction of the dummy device (in degrees)")
	public Integer getDirection() {
		return device.getDirection();
	}
	
	@Override
	public String getRequiredDevice() {
		return DummyDevice.ID;
	}

}

